import service from "./index";
import store from "@/store";

const request = function() {};

request.post = function(url, data) {
  //store.getters.ignoreToken = isToken === true ? true : false;
  return new Promise((resolve, reject) => {
    service
      .post(url, data)
      .then(function(res) {
        resolve(res.data);
      })
      .catch(res => {
        reject(res.data);
      });
  });
};

request.get = function(url, data) {
  //store.getters.ignoreToken = isToken === true ? true : false;
  return new Promise((resolve, reject) => {
    service
      .get(url, data)
      .then(function(res) {
        resolve(res.data);
      })
      .catch(res => {
        reject(res.data);
      });
  });
};

export default request;
